<%-- 
    Document   : contact
    Created on : Aug 2, 2011, 3:39:01 PM
    Author     : darshana
--%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>

<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
    <head>
        <title>
            Contact form
        </title>
        <style>
.error {
color: #ff0000;
font-style: italic;
}
</style>
        <script>

            function pop(){
                
            alert(document.getElementById(fname).innerHTML.toString());

            }


        </script>

    </head>
    <body>
        <%--<form method="post" action="addContact.html">
            <table>
                <tr>
                    <td>First Name</td>
                    <td><input type="text" name="fname"></td>
                </tr>
                <tr>
                    <td>Last Name</td>
                    <td><input type="text" name="lname"></td>
                </tr>
                <tr>
                    <td>Email</td>
                    <td><input type="text" name="email"></td>
                </tr>
                <tr>
                    <td>Telephone</td>
                    <td><input type="text" name="tp"></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" value="Add Contact"/>
                    </td>
                </tr>
            </table>
        </form>--%>
        <a href="email">Send</a>

        <form:form method="post" action="addContact" commandName="contact">
            <table>
                <tr>
                    <td>First Name</td>
                    <td><form:input path="fname" /></td>
                    <td id="fname"><form:errors path="fname" cssClass="error"/></td>
                </tr>
                <tr>
                     <td>Last Name</td>
                    <td><form:input path="lname" /></td>
                    <td><form:errors path="lname" cssClass="error"/></td>
                </tr>
                <tr>
                     <td>E mail</td>
                    <td><form:input path="email" /></td>
                    <td><form:errors path="email" cssClass="error"/></td>
                </tr>
                <tr>
                    <td>Telephone</td>
                    <td><form:input path="tp" /></td>
                    <td><form:errors path="tp" cssClass="error"/></td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" value="Add Contact"/>
                    </td>
                </tr>
            </table>
        </form:form>
    </body>
</html>

<h3>Contacts</h3>
<%--<c:if  test="${!empty contactList}">
    <table class="data" border="1">
        <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Email</th>
            <th>Telephone</th>
            <th>&nbsp;</th>
        </tr>
        <c:forEach items="${contactList}" var="contact">
            <tr>
                <td>${contact.id}</td>
                <td>${contact.lname}, ${contact.fname} </td>
                <td>${contact.email}</td>
                <td>${contact.tp}</td>
                <td><a href="delete/${contact.id}">delete</a></td>
            </tr>
        </c:forEach>
    </table>
</c:if>--%>


<%--
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>--%>
